

package IHM;
import java.awt.*;

import javax.swing.*;

import java.awt.event.*;



public class BoutonRond extends JComponent implements DimensionIHM
{
	
	public int x,y,rayon;
	 
	public boolean etat;
	
	public Color couleur;
	
	public BoutonRond (int i,int j) 
	{
		
		this.etat = true;
		this.rayon = RAYON_CERCLE;		
		setPositionBoutonRond(i,j);
		getCouleurBoutonRond();
		
	}

	public void  setPositionBoutonRond(int i,int j){
		
		this.x = ABSCISSE_PRMEIER_CERCLE;
		this.y = ORDONNE_PREMIER_CERCLE;
		
		/*
		this.x = ABSCISSE_PRMEIER_CERCLE + i*GAP_HORIZONTAL_CERCLE;
		this.y = ORDONNE_PREMIER_CERCLE + j*GAP_VERTICAL_CERCLE;
			*/	
	}

	public void setEtat(boolean EtatRessource)
	{
		
		this.etat = EtatRessource;
		
	}
	
	public Color getCouleurBoutonRond(){
		
		if(etat)
			return Color.green;
		
		else
			return Color.red;
		
	}
	
	public void paintComponent(Graphics g){
	
		super.paintComponent(g);
		
		
		g.setColor(getCouleurBoutonRond());
		
		g.fillOval(this.x,this.y,rayon,rayon);
		
	}
	
}